package com.sqfw.project.wp.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sqfw.framework.aspectj.lang.annotation.Log;
import com.sqfw.framework.aspectj.lang.enums.BusinessType;
import com.sqfw.project.wp.domain.WpReviewedItemLog;
import com.sqfw.project.wp.service.IWpReviewedItemLogService;
import com.sqfw.framework.web.controller.BaseController;
import com.sqfw.framework.web.domain.AjaxResult;
import com.sqfw.common.utils.poi.ExcelUtil;
import com.sqfw.framework.web.page.TableDataInfo;

/**
 * 审核人审核记录Controller
 * 
 * @author lx
 * @date 2023-08-14
 */
@RestController
@RequestMapping("/wp/wpReviewedLog")
public class WpReviewedItemLogController extends BaseController
{
    @Autowired
    private IWpReviewedItemLogService wpReviewedItemLogService;

    /**
     * 查询审核人审核记录列表
     */
    @PreAuthorize("@ss.hasPermi('wp:wpReviewedLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(WpReviewedItemLog wpReviewedItemLog)
    {
        startPage();
        List<WpReviewedItemLog> list = wpReviewedItemLogService.selectWpReviewedItemLogList(wpReviewedItemLog);
        return getDataTable(list);
    }

    /**
     * 导出审核人审核记录列表
     */
    @PreAuthorize("@ss.hasPermi('wp:wpReviewedLog:export')")
    @Log(title = "审核人审核记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WpReviewedItemLog wpReviewedItemLog)
    {
        List<WpReviewedItemLog> list = wpReviewedItemLogService.selectWpReviewedItemLogList(wpReviewedItemLog);
        ExcelUtil<WpReviewedItemLog> util = new ExcelUtil<WpReviewedItemLog>(WpReviewedItemLog.class);
        util.exportExcel(response, list, "审核人审核记录数据");
    }

    /**
     * 获取审核人审核记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('wp:wpReviewedLog:query')")
    @GetMapping(value = "/{autoId}")
    public AjaxResult getInfo(@PathVariable("autoId") Long autoId)
    {
        return success(wpReviewedItemLogService.selectWpReviewedItemLogByAutoId(autoId));
    }

    /**
     * 新增审核人审核记录
     */
    @PreAuthorize("@ss.hasPermi('wp:wpReviewedLog:add')")
    @Log(title = "审核人审核记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WpReviewedItemLog wpReviewedItemLog)
    {
        return toAjax(wpReviewedItemLogService.insertWpReviewedItemLog(wpReviewedItemLog));
    }

    /**
     * 修改审核人审核记录
     */
    @PreAuthorize("@ss.hasPermi('wp:wpReviewedLog:edit')")
    @Log(title = "审核人审核记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WpReviewedItemLog wpReviewedItemLog)
    {
        return toAjax(wpReviewedItemLogService.updateWpReviewedItemLog(wpReviewedItemLog));
    }

    /**
     * 删除审核人审核记录
     */
    @PreAuthorize("@ss.hasPermi('wp:wpReviewedLog:remove')")
    @Log(title = "审核人审核记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{autoIds}")
    public AjaxResult remove(@PathVariable Long[] autoIds)
    {
        return toAjax(wpReviewedItemLogService.deleteWpReviewedItemLogByAutoIds(autoIds));
    }
}
